let url4 = new URL("./image/fish.png",window.location.href)
// 设置一个图标对象
var icon = {
   // 图标类型，现阶段只支持 image 类型
   type: 'image',
   // 图片 url
   image: url4,
   // 图片尺寸
   size: [64, 30],
   // 图片相对 position 的锚点，默认为 bottom-center
   anchor: 'center',
};
var textStyle = {
    fontSize: 12,
    fontWeight: 'normal',
    fillColor: '#22886f',
    strokeColor: '#fff',
    strokeWidth: 2,
    fold: true,
    padding: '2, 5',
};
var fishLabelsData = [
    {
        name: '钓鱼场地',
        position: [114.050121, 23.072906],
        zooms: [10, 20],
        opacity: 1,
        zIndex: 10,
        fold: true,
        icon,
        text: {
            // 要展示的文字内容
            content: '钓鱼场地',
            // 文字方向，有 icon 时为围绕文字的方向，没有 icon 时，则为相对 position 的位置
            direction: 'right',
            // 在 direction 基础上的偏移量
            offset: [-20, -5],
            // 文字样式
            style: {
                // 字体大小
                fontSize: 12,
                // 字体颜色
                fillColor: '#22886f',
                //
                strokeColor: '#fff',
                strokeWidth: 2,
                fold: true,
                padding: '2, 5',
            }
        }
    },
        {
                name: '自提点2',
                position: [117.192382, 39.235267],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '金池垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点3',
                position: [114.684065, 35.200556],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '红旗阳关暖棚钓鱼馆',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点4',
                position: [114.086256, 22.545951],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '游乐游艺店',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点5',
                position: [116.976762, 40.408408],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '鑫源垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点6',
                position: [113.318447, 22.590923],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '渔道钓场',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点7',
                position: [107.982098, 22.148715],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '明志垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点8',
                position: [117.240109, 39.266941],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '汇宾垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点9',
                position: [112.194595, 37.446499],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '洪义垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点10',
                position: [117.097851, 39.161476],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '三和垂钓中心',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点11',
                position: [109.943096, 35.193775],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '老兵生态土鸡养殖基地垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点12',
                position: [117.781984, 30.808332],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '老王垂钓基地',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点13',
                position: [117.293063, 39.271298],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '老五鱼池',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点14',
                position: [120.097132, 31.694582],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '青盛渔场',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点15',
                position: [120.477249, 36.311119],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '李辛庄垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点16',
                position: [114.496777, 23.843255],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '38号鱼坑',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点17',
                position: [116.843983, 36.677724],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '乐钓垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点18',
                position: [117.326882, 39.262386],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '子信垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点19',
                position: [117.311928, 39.206096],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '绿景垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点20',
                position: [117.325247, 39.132261],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '万乐钓鱼城',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点21',
                position: [86.040853, 44.313112],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '君再来垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点22',
                position: [117.200983, 39.084158],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '天津野钓基地',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点23',
                position: [103.860279, 30.026454],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '渔乐钓社',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点24',
                position: [117.15773, 39.076191],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '南翠屏垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点25',
                position: [121.659378, 29.958345],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '老周垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点26',
                position: [117.297864, 39.130671],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '联盟路亚基地',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点27',
                position: [121.395737, 29.098091],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '鼎盛垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点28',
                position: [107.518723, 25.34227],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '小包海钓俱乐部',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点29',
                position: [117.570942, 38.771833],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '海钓会',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点30',
                position: [117.484016, 38.872943],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '海通钓鱼城',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点31',
                position: [117.484832, 38.873467],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '海通湖渔村',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点32',
                position: [116.976762, 40.408408],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '庆哥垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点33',
                position: [113.199736, 22.610374],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '小孙蛎钓虾场',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点34',
                position: [116.976762, 40.408408],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '久缘垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点35',
                position: [117.422104, 39.046026],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '国胜垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点36',
                position: [117.449213, 38.907336],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '小站聚友垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点37',
                position: [119.65967, 32.122289],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '老左营二才黑坑钓场',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点38',
                position: [117.419183, 38.985562],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '双赢垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点39',
                position: [116.976762, 40.408408],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '曙光垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点40',
                position: [106.194827, 32.897893],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '海河湾垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点41',
                position: [116.976762, 40.408408],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '顺欣垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点42',
                position: [117.606321, 38.987525],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '塘沽湾路亚基地',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点43',
                position: [117.327596, 39.132038],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '景旺垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点44',
                position: [115.832695, 40.909737],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '瑞福林垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点45',
                position: [119.310089, 26.059538],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '双丰花园钓场',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        {
                name: '自提点46',
                position: [116.976762, 40.408408],
                zooms: [10, 20],
                opacity: 1,
                zIndex: 16,
                icon,
                text: {
                    content: '鸿余垂钓园',
                    direction: 'right',
                    offset: [-20, -5],
                    style: textStyle
                }
            },
        ];

var fishmarkers = [];
var allowCollision = false;
var fishlayer = new AMap.LabelsLayer({
zooms: [3, 20],
zIndex: 1000,
// collision: false,
// 设置 allowCollision：true，可以让标注避让用户的标注
allowCollision,
});
fishlayer.add(fishmarkers);
// 图层添加到地图
map.add(fishlayer);

//初始化 labelMarker
for (var i = 0; i < fishLabelsData.length; i++) {
    var curData = fishLabelsData[i];
    curData.extData = {
        index: i
    };

    var fishlabelMarker = new AMap.LabelMarker(curData);

    fishmarkers.push(fishlabelMarker);

}



   


